//
//  DocumentFunction.swift
//  CheckmeRing
//
//  Created by 董鹏 on 2022/3/25.
//

import UIKit
import Foundation

class DocumentFunction: NSObject {

    //MARK:document文档目录
    static func documentPath() -> String {
        let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! as String
        return documentPath
    }
    
    //MARK:文件路径
    static func downloadDirectory(path:String) -> String {
        let downloadFile = DocumentFunction.documentPath() + "/\(path)/"
        let fileManager = FileManager.default
        if fileManager.fileExists(atPath: downloadFile) == false {
            do {
                try fileManager.createDirectory(atPath: downloadFile, withIntermediateDirectories: true, attributes: nil)
            } catch {
                print(error)
            }
        }
        return downloadFile
    }
    
}
